package com.pro.controller;

import com.pro.service.PubService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@CrossOrigin
public class PubController {
    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    @Autowired
    private PubService pubService;

    // 发送验证码（生成四位随机数，并发送到redis，定时，再发送到rabbitmq中）
    @RequestMapping("/SendYanzhengma")
    @ResponseBody
    public String SendYanzhengma(){
        Integer yanzhengma = pubService.SendYanzhengma();
        System.out.println("随机生成的四位数验证码是："+yanzhengma);
        return "随机生成的四位数验证码是："+yanzhengma;
    }

}
